/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "S_Object.h"

#include <向量.h>


typedef struct {
	void*   Data;
	vec2    开始;
	float32 长度;
	uint32  ID;
}S_轨道条;



EngineAPI_EXPORT void f_anim_新建轨道条();
EngineAPI_EXPORT void f_anim_销毁轨道条();


EngineAPI_EXPORT S_轨道层*		f_anim_创建轨道层(DEF_WString name);
EngineAPI_EXPORT void			f_anim_销毁轨道层(S_轨道层* 层);

EngineAPI_EXPORT S_TrackSample*	f_anim_创建采样条(E_采样条类型 条类型);
EngineAPI_EXPORT void			f_anim_销毁采样条(S_TrackSample* 采样条);

//void f_anim_采样条填充数据(S_TrackSample* ts, const std::vector<float32>& data);

EngineAPI_EXPORT int32 f_anim_时间转帧(S_时间线* 时间线);
EngineAPI_EXPORT int32 f_anim_时间转帧(S_时间线* 时间线, float64 时间);


Inline std::vector<float32>& f_anim_get波形轨道采样数据(S_TrackSample* ts) {
	return (*(std::vector<float32>*)ts->m_Address_Point);
}

EngineAPI_EXPORT bool f_anim_帧是否在采样条内(const S_TrackSample* ts, int32 帧);

Inline bool f_anim_帧是否在采样条内(const S_TrackSample* ts, int32 帧, int32 长度限制) {
	return 帧 >= ts->m_SampleStart && 帧 < ts->m_SampleStart + min(ts->m_SampleLength, 长度限制);
}


